function Test-Workspace ($localPath){
    if( Test-path $localPath) {
        try { $workspaceOutput = Invoke-TF workfold $localPath } catch{$_}
        if($LASTEXITCODE -eq 0) {
            $workspaceName = Get-WorkspaceName $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($localPath)
            foreach($line in $workspaceOutput) {
                if ($line.startsWith("Workspace : $workspaceName")) {return $false}
            }
            Write-Output "A workspace currently exists at $localPath and is not empty. No workspace will be created."
            return $true
        }
    }
    return $false
}